import { createApp } from "vue";
import pinia from "./stores";

import App from "./App.vue";
import router from "./router";
import "./styles/index.scss";
import ElSvg from "./components/SvgIcon/ElSvg";

import PermissionButton from "./components/PermissionButton/index.vue";
import Chart from "./components/Chart/index.vue";
import "./permission";
import registerPermissionDirective from "@/directives/permission";

import actions from "./actions";

const app = createApp(App);

ElSvg(app);

// 注册全局组件
app.component("PermissionButton", PermissionButton);
app.component("Chart", Chart);

// 注册指令
registerPermissionDirective(app);

app.use(pinia).use(router).mount("#app");

// 微前端部分：
import { registerMicroApps, start } from "qiankun";

registerMicroApps([
  {
    name: "product",
    entry: "//localhost:9528",
    container: "#product-container",
    activeRule: "/product",
    props: {
      actions,
    },
  },
  {
    name: "storage",
    entry: "//localhost:3007",
    container: "#storage-container",
    activeRule: "/storage",
    props: {
      actions,
    },
  },
  {
    name: "hospital",
    entry: "//localhost:3000",
    container: "#hospital-container",
    activeRule: "/hospital",
    props: {
      actions,
    },
  },
]);
// 启动 qiankun
// start();
